package com.sunday.player.util;

import java.util.ArrayList;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.widget.EditText;
import android.widget.Toast;

import com.sunday.player.R;
import com.sunday.player.basicActivity;
import com.sunday.player.domain.musicData;
import com.sunday.player.domain.musiclist;

public class AlertBoxColtroler {
    private basicActivity mActivity;
    /**
     * 리스트 만들기
     */
    public static final int Show_MakeList = 0;
    public static final int Show_DeleteListOK = 1;
    
    public AlertBoxColtroler(basicActivity activity) {
	this.mActivity = activity;
    }
    public void showDialog(int Index){
	switch (Index) {
	case Show_MakeList:
	    MakeList();
	    break;
	case Show_DeleteListOK:
	    deleteComplte();
	    break;
	    
	default:
	    break;
	}
    }
    
    private void deleteComplte() {
	// TODO Auto-generated method stub
	
    }
    private void MakeList(){
	final EditText RT = new EditText(mActivity);

	
	
	AlertDialog  	dia = new AlertDialog.Builder(mActivity)
	.setView(RT)
	.setPositiveButton("만들기", new OnClickListener() {
	    
	    @Override
	    public void onClick(DialogInterface dialog, int which) {
		String title = RT.getText().toString();
		if(title == null || title.length() <1){
		    RT.setText(null);
		    Toast.makeText(mActivity, mActivity.getString(R.string.Toast_Mess_set_title), Toast.LENGTH_SHORT).show();
		    
		}else{
		    musiclist listitem = new musiclist(title, false, new ArrayList<musicData>());
		    mActivity.getdBcontroler().list_make(listitem);
		    mActivity.onScreenUpdate();
		   dialog.dismiss();
		   
		}
	    }
	})
	.setNegativeButton("취소", null).create();
	
	dia.show();
	
    }

}
